﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:controls="clr-namespace:AutomationMLMapper.Controls"
	    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
		xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
		xmlns:ConvertersAndTemplateSelectors="clr-namespace:AutomationMLMapper.Controls.ConvertersAndTemplateSelectors"
        xmlns:MarkupExtensions="clr-namespace:AutomationMLMapper.Controls.MarkupExtensions"
		xmlns:local="clr-namespace:AutomationMLMapper.Controls"
		xmlns:Properties="clr-namespace:AutomationMLMapper.Properties" x:Class="AutomationMLMapper.AutomationMLMapperMain"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"					 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        Title="AutomationML Export Import Mapping"
		x:Name="Window" mc:Ignorable="d" 
		xmlns:settings="clr-namespace:AutomationMLMapper.Utilities"
		xmlns:avalondock="clr-namespace:AvalonDock;assembly=AvalonDock"
		xmlns:avalonLayout="clr-namespace:AvalonDock.Layout;assembly=AvalonDock"
		xmlns:avalonThemes="clr-namespace:AvalonDock.Themes;assembly=AvalonDock.Themes.Aero"
		xmlns:avalonControls="clr-namespace:AvalonDock.Controls;assembly=AvalonDock"
		d:DesignWidth="1003" d:DesignHeight="668"
		Icon="App.ico" Background="#FFE8EFF8">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/AutomationMLMapper;component/StyleResources/ListStyle.xaml" />
                <ResourceDictionary Source="/AutomationMLMapper;component/StyleResources/Templates.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <ConvertersAndTemplateSelectors:BoolToVisibilityConverter FalseValue="Collapsed" x:Key="btvc" />

        </ResourceDictionary>
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <DockPanel>
            <Menu>
                <MenuItem Header="{x:Static Properties:Resources.File}"
				          ToolTip="{x:Static Properties:Resources.AutomationMLEditor}">
                    <MenuItem.Icon>
                        <Image Width="16" Source="/AutomationMLMapper;component/Images/AMLIcon.ico" />
                    </MenuItem.Icon>

                    <MenuItem Header="{x:Static Properties:Resources.Edit}"
				          ToolTip="{x:Static Properties:Resources.AutomationMLEditor}">
                        <MenuItem.Icon>
                            <Image Width="16" Source="/AutomationMLMapper;component/Images/AMLIcon.ico" />
                        </MenuItem.Icon>
                    </MenuItem>

                    <MenuItem Header="{x:Static Properties:Resources.Save}"
		                        ToolTip="{x:Static Properties:Resources.SaveAutomationMLDocument}">
                        <MenuItem.Icon>
                            <Image Width="16" Source="/AutomationMLMapper;component/Images/saveHS.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    
                    
                    <Separator/>
                    <MenuItem Command="ApplicationCommands.Close" Header="{x:Static Properties:Resources.RecentDocuments}">
                    </MenuItem>

                    <MenuItem Command="ApplicationCommands.Close" Header="Exit" >
                        <MenuItem.Icon>
                            <Image Source="/AutomationMLMapper;component/Images/sign-out.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                </MenuItem>

                <MenuItem Header="{x:Static Properties:Resources.Test}"></MenuItem>
            </Menu>
        </DockPanel>


        <Grid x:Name="ContentGrid"  Grid.Row="1">
            <Grid.LayoutTransform>
                <TransformGroup>
                    <ScaleTransform ScaleY="{Binding ZoomValue, ElementName=slider}"
								ScaleX="{Binding ZoomValue, ElementName=slider}" />
                </TransformGroup>
            </Grid.LayoutTransform>

            <avalondock:DockingManager x:Name="dockManager"  AnchorablesSource="{Binding AutomationMLTools}">
                <avalondock:DockingManager.Theme>
                    <avalonThemes:AeroTheme/>
                </avalondock:DockingManager.Theme>

                <avalondock:DockingManager.LayoutUpdateStrategy>
                    <local:LayoutInitializer/>
                </avalondock:DockingManager.LayoutUpdateStrategy>

                <avalondock:DockingManager.LayoutItemTemplateSelector>
                    <ConvertersAndTemplateSelectors:PanesTemplateSelector>
                        <ConvertersAndTemplateSelectors:PanesTemplateSelector.DifferntRolesViewTemplate>
                            <DataTemplate>
                                <local:DifferenceRoleClassListControl DataContext="{Binding}">
                                </local:DifferenceRoleClassListControl>
                            </DataTemplate>
                        </ConvertersAndTemplateSelectors:PanesTemplateSelector.DifferntRolesViewTemplate>
                        <ConvertersAndTemplateSelectors:PanesTemplateSelector.SupportedRolesViewTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="*"></RowDefinition>
                                    </Grid.RowDefinitions>

                                    <TextBlock Grid.Row="0" Padding="2">
										<Run Text="Name of the System Unit Class: " FontWeight="DemiBold"></Run>
										<Run Text="{Binding CollectionOwner.Name}"></Run>
                                    </TextBlock>
                                    <local:CAEXCollectionView DataContext="{Binding RolesCollection}" Grid.Row="1"
														  AllowEditElement ="False"                                                          
														  AddToolTipDescription="To add a supported-RoleClass, please select a RoleClass from any RoleClass-Library which has not yet been assigned to the SystemUnitClass"
														  DeleteToolTipDescription="The selected Supported RoleClass is removed from the SystemUnitClass to which it is assigned to"/>

                                </Grid>
                            </DataTemplate>
                        </ConvertersAndTemplateSelectors:PanesTemplateSelector.SupportedRolesViewTemplate>
                    </ConvertersAndTemplateSelectors:PanesTemplateSelector>
                </avalondock:DockingManager.LayoutItemTemplateSelector>

                <avalondock:DockingManager.LayoutItemContainerStyleSelector>
                    <ConvertersAndTemplateSelectors:PanesStyleSelector>
                        <ConvertersAndTemplateSelectors:PanesStyleSelector.SupportedRolesViewStyle>
                            <Style TargetType="{x:Type avalonControls:LayoutAnchorableItem}">
                                <Setter Property="Title" Value="List of SupportedRoleClasses"/>
                                <Setter Property="IconSource" Value="{MarkupExtensions:ImageResolution Source=SRC.ico,Size=24}"/>
                                <Setter Property="ContentId" Value="SupportedRoleClasses"/>
                                <Setter Property="Visibility" Value="Visible"></Setter>
                                <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            </Style>
                        </ConvertersAndTemplateSelectors:PanesStyleSelector.SupportedRolesViewStyle>

                        <ConvertersAndTemplateSelectors:PanesStyleSelector.DifferentRolesViewStyle>
                            <Style TargetType="{x:Type avalonControls:LayoutAnchorableItem}">
                                <Setter Property="Title" Value="List of different RoleClasses"/>
                                <Setter Property="IconSource" Value="/AutomationMLMapper;component/Images/Diff.png"/>
                                <Setter Property="ContentId" Value="Different Role Classes"/>
                                <Setter Property="Visibility" Value="Visible"></Setter>
                                <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            </Style>
                        </ConvertersAndTemplateSelectors:PanesStyleSelector.DifferentRolesViewStyle>

                    </ConvertersAndTemplateSelectors:PanesStyleSelector>
                </avalondock:DockingManager.LayoutItemContainerStyleSelector>

                <avalonLayout:LayoutRoot>
                    <avalonLayout:LayoutPanel>
                        <avalonLayout:LayoutAnchorablePaneGroup x:Name="SourceSystemPaneGroup" Orientation="Vertical" DockWidth="40*">
                            <avalonLayout:LayoutAnchorablePaneGroup x:Name="SystemUnitClassGroup" Orientation="Horizontal" DockHeight="70*">
                                <avalonLayout:LayoutAnchorablePane Name="SourceSystemPane" DockWidth="60*">
                                    <avalonLayout:LayoutAnchorable ContentId="SourceClassList"  Title="{x:Static Properties:Resources.SourceSystem}"
																   CanClose="False"                                                               
																   IconSource="{MarkupExtensions:ImageResolution Source=SC.ico, Size=24}">
                                        <controls:SystemUnitClassListControl DataContext="{Binding Export}" Background="Transparent" />
                                    </avalonLayout:LayoutAnchorable>
                                </avalonLayout:LayoutAnchorablePane>
                            </avalonLayout:LayoutAnchorablePaneGroup>
                        </avalonLayout:LayoutAnchorablePaneGroup>
                    </avalonLayout:LayoutPanel>

                </avalonLayout:LayoutRoot>
            </avalondock:DockingManager>

        </Grid>
        <StatusBar Background="Transparent" Grid.Row="2" HorizontalAlignment="Stretch">

            <StatusBarItem DockPanel.Dock="Left">
                <Image ToolTip="AutomationML Website" Height="36" Width="240"
					   Source="/AutomationMLMapper;component/Images/banner.PNG" Stretch="UniformToFill">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="MouseLeftButtonDown">
                            <ei:LaunchUriOrFileAction Path="http://www.automationml.org" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Image>
            </StatusBarItem>
            <StatusBarItem DockPanel.Dock="Right" HorizontalAlignment="Right">
                <controls:ZoomSliderControl ZoomValue="{Binding ZoomValue, Source={x:Static Properties:Settings.Default}, Mode=TwoWay}"  x:Name="slider" />
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
